package com.gblw.rjkf.pj.utils;

import cn.dev33.satoken.stp.StpInterface;
import com.gblw.rjkf.pj.service.SysRoleService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;


/**
 * 自定义Sa-Token权限认证接口扩展
 *
 * @author wj
 */
@Component
public class StpInterfaceImpl implements StpInterface {
    @Resource
    SysRoleService sysRoleService;

    /**
     * 返回一个账号所拥有的权限码集合
     */
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return sysRoleService.cachedPermissions();
    }

    /**
     * 返回一个账号所拥有的角色标识集合
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return sysRoleService.getRoleList();
    }
}
